<%@ taglib prefix="uthink" uri="/WEB-INF/tld/shiros.tld"%>

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,member-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<script type="text/javascript" src="lib/PIE_IE678.js"></script>
<![endif]-->
<link href="css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="css/H-ui.admin.css" rel="stylesheet" type="text/css" />
<link href="css/pagination.css" rel="stylesheet" type="text/css" />
<link href="lib/Hui-iconfont/1.0.1/iconfont.css" rel="stylesheet"
	type="text/css" />
<!--[if IE 6]>
<script type="text/javascript" src="http://lib.h-ui.net/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>品牌管理</title>

</head>
<body>
	<nav class="breadcrumb">
		<i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span>
		商品中心 <span class="c-gray en">&gt;</span> 品牌管理

		<a class="btn btn-success btn-refresh radius r mr-20"
			style="line-height: 1.6em; margin-top: 3px"
			onclick="javascript:location.replace(location.href);"
			href="javascript:location.replace(location.href);" title="刷新">刷新</a>
	</nav>
	<div class="pd-20">

		<div class="mt-20">
			<table
				class="table table-border table-bordered table-hover table-bg table-sort">
				<thead>
					<tr class="text-c">

						<th width="80">编号</th>
						<th>品牌名称</th>

						<th>名牌别名</th>
						<th width="100">品牌logo</th>
						<th width="120">品牌网址</th>
						<th width="80">是否可用</th>

						<th width="120">操作</th>
					</tr>
				</thead>
				<tbody>
					<c:choose>
						<c:when test="${empty t_brands}">
							<tr class="text-c">
								<td colspan="7">暂无数据</td>
							</tr>
						</c:when>
						<c:otherwise>
							<c:forEach items="${t_brands}" var="t_brand">
								<tr class="text-c">
									<input type="hidden" id="brand_id" name="brand_id"
										value='${t_brand.brand_id}' />

									<td>${t_brand.brand_id}</td> 
									<td>${t_brand.brand_name}</td>

									<td>${t_brand.brand_keywords}</td> 	
									<td><img src="<%=imagePath%>${t_brand.brand_logo}"  style="height:30px"/></td>
									<td>${t_brand.brand_url}</td>
									<td><c:choose>
											<c:when test="${t_brand.disabled==1}">有效</c:when>
											<c:otherwise>失效</c:otherwise>
										</c:choose></td>
									<td class="td-manage">
										<a onClick="t_brand_edit(this,'${t_brand.brand_id}','edit')" href="javascript:void(0);" title="编辑">编辑</a>
										&nbsp;&nbsp;
										<a onClick="t_brand_delete(this,'${t_brand.brand_id}')" href="javascript:void(0);" title="删除">删除</a></td>
								</tr>
							</c:forEach>
						</c:otherwise>
					</c:choose>

				</tbody>
			</table>

			

		</div>
	</div>
	<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
	<script type="text/javascript" src="lib/layer/1.9.3/layer.js"></script>
<script type="text/javascript"
		src="lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
	<script type="text/javascript">
			$(function() {
			$('.table-sort').dataTable({
				"aaSorting" : [ [ 0, "desc" ] ],//默认第几个排序
				"bStateSave" : true,//状态保存
				   bFilter: false,    //去掉搜索框
                 bLengthChange: false,   //去掉每页显示多少条数据
				"aoColumnDefs" : [
				//{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
				{
					"orderable" : false,
					"aTargets" : [ 1, 2 ]
				} // 制定列不参与排序
				]
			});
	datable.fnClearTable();
		});
		/*添加*/
		function t_member_add(title, url, w, h) {
			layer_show(title, url, w, h);
		}

		/*编辑*/
		function t_brand_edit(obj,id,w,h){
			var edit_page = "<%=path%>/backstage/brand-add-pre?brand_id="+id+"&status="+w;
			var index = layer.open({
				type: 2,
				title: "编辑",
				content: edit_page
			});
			layer.full(index);
		}

		/*删除*/
		function t_brand_delete(obj,id){
			layer.confirm('确认删除？', {
				btn: ['确认','取消'], 
				shade: false
			},
			function(){
				$.ajax({
					type : "POST",
					url : "<%=path%>/backstage/brand-delete",
					data : "id=" + id,
					error : function() {
						layer.msg('操作失败', {
							icon : 5,
							time : 1000
						});
					},
					success : function(msg) {
						layer.msg('已删除 ' + msg.information, {
							icon : 6,
							time : 1000
						});
						$(obj).parents("body").find(".btn-refresh").click();
					}
				});
			}, function() {
				layer.msg('未删除', {
					icon : 5,
					time : 1000
				});
			});
		}
	</script>
</body>
</html>



